# https://sh.meituan.com/
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import json


# EC.presence_of_element_located（）是确认元素是否已经出现了
# EC.element_to_be_clickable（）是确认元素是否是可点击的


def get_list(url):
    browser = webdriver.Chrome()
    browser.get('https://sh.meituan.com/meishi/')
    # wait = WebDriverWait(browser, 10)
    list = browser.find_elements(By.CLASS_NAME, 'list-ul')
    return list


def parse_list(list):
    img = json.dumps(list.find_element(By.CLASS_NAME, 'img').text)
    info = json.dumps(list.find_element(By.CLASS_NAME, 'info').text)
    print(img, info)


if __name__ == '__main__':
    list = get_list('x')
    parse_list(list)
